//
//  ViewController.swift
//  JKFieldAndTextViewLimit
//
//  Created by IronMan on 2021/4/2.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .white
        
        let button1 = UIButton(frame: CGRect(x: kScreenW / 2.0 - 150, y: 150, width: 100, height: 50))
        button1.setTitle("UITextField", for: .normal)
        button1.backgroundColor = .randomColor
        button1.addTarget(self, action: #selector(click1), for: .touchUpInside)
        self.view.addSubview(button1)
        
        let button2 = UIButton(frame: CGRect(x: kScreenW / 2.0 + 50, y: 150, width: 100, height: 50))
        button2.setTitle("UITextView", for: .normal)
        button2.backgroundColor = .randomColor
        button2.addTarget(self, action: #selector(click2), for: .touchUpInside)
        self.view.addSubview(button2)
        
    }
    
    @objc func click1() {
        let vc = UITextFieldEditViewController(editType: .userNickName, titleName: "修改昵称", placeholder: "请输入昵称", maxCharacters: 10, content: "王三", regex: JKRegexCharacterType.type10.rawValue)
        vc.modalPresentationStyle = .fullScreen
        self.navigationController?.pushViewController(vc, animated: true)
    }
    
    @objc func click2() {
        let vc = UITextViewEditViewController(editType: .introduction, titleName: "", placeholder: "默认文字", maxCharacters: 20, content: "我是一只小小鸟", bottomTipString: "底部的文字")
        vc.modalPresentationStyle = .fullScreen
        self.navigationController?.pushViewController(vc, animated: true)
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        
    }
}

